F1='DLV_PHAR'
F3='DLV_TEMP'
DO ADDRESSS
@ 8,1 clea to 23,78
@ 7,4 to 9,37
@ 8,6 say 'PRINT RECAP. OF DELIVERY ORDER'
DSP1=SAVESCREEN(24,0,24,79)
F1='DLV_PHAR'
F2='COMPANY'
SELE 1
SET EXCLU OFF
USE &DR&F1
INDEX ON delv_order TO &DR&F1
SET EXCLU OFF
SELE 1
SET EXCLU OFF
USE &DR&F1 INDEX &DR&F1
SELE 2
SET EXCLU OFF
USE &DR&F2
RESTSCREEN(24,0,24,79,DSP1)
KLR='N'
DO SET_DEV
IF KLR='Y'
   SET EXCLU OFF
   CLOSE DATA
   CLOSE INDEX
   RETURN
ENDIF
   SET COLO TO W+/B+
   DO ADDRESSS
*   @  7,  3  TO  9, 33    DOUBLE
*   @  8,  5  SAY "PRINT RECAP. DELIVERY ORDER"
   KLR='N'
   br=100
   fl=0
   hl=0
   ttl=0
   store 0 to ttl1,ttl2,ttl3,ttl4,ttl5
   set devi to print
*   @ 0,0 say chr(18) pict 'x'
*   @ 0,0 SAY CHR(27)+CHR(77)
SELE 1
GO TOP
DO WHILE .NOT. EOF()
    IF MONTH(PRINT_DATE)<>MONTH(DATE())
       SKIP
       LOOP
    ENDIF
    if br>57
     if fl>0
       eject
     else
       fl=1
     endif
     cl=50
     hl=hl+1
     @  2, 44 say 'RECAPITULATION OF DELIVERY ORDER'
     @  3, 44 SAY '--------------------------------'
     @  4,122 say 'PAGE : '
     @  4,129 say hl pict '999'
     @  5,117 say 'DATE : '
     @  5, 124 say DATE()
     @  6,  0 say repl('=',132)
     @  7,  0 say 'ORDER #'
     @  7, 17 say 'DATE'
     @  7, 26 say 'COMPANY'
     @  7, 34 say 'NAME'
     @  7, 71 say '  TOTAL VALUE'
     @  7, 87 SAY 'DRUG/DISPOSABLE NAME'
     @  7,124 SAY 'QUANTITY'
     @  9,0 say repl('-',132)
     br=9
    endif
    br=br+1
      ORDNUM=delv_order
      DATDLV=PRINT_DATE
      CODCLI=COMP_CODE
      NAMCLI=CLIENT
      @ BR, 0 SAY ORDNUM
      @ BR,17 SAY DATDLV
      @ BR,26 SAY CODCLI
      @ BR,34 SAY NAMCLI
      TTL=0
      SEEK ORDNUM
      DO WHILE delv_order=ORDNUM .AND. .NOT. EOF()
         TTL=TTL+VAL_DELV
         SKIP
      ENDDO
      @ BR,71 SAY TTL PICT '9,999,999,999'
      SEEK ORDNUM
      DO WHILE delv_order=ORDNUM .AND. .NOT. EOF()
         NMPH=SUBS(ALLTRIM(PHAR_NAME)+' '+ALLTRIM(PHAR_TYPE)+' '+ALLTRIM(PHAR_QANT)+' '+ALLTRIM(PHAR_UNIT),1,35)
         @ BR,87 SAY NMPH
         @ BR,127 SAY QANT_DELV PICT '9,999'
         BR=BR+1
         SKIP
      ENDDO
      TTL1=TTL1+TTL
ENDDO
BR=BR+1
@ BR,0 SAY REPL('-',132)
BR=BR+1
@ BR,70 SAY TTL1 PICT '99,999,999,999'
BR=BR+1
@ BR,0 SAY REPL('=',132)
EJECT
@ 0,0 SAY CHR(18) PICT 'X'
SET DEVI TO SCREEN
CLOSE DATA
CLOSE INDEX
RETURN


